﻿namespace SmartCommunity.Common
{
    public static class LoginUserExtensions
    {
        public static UserData GetUserData(this LoginUser user)
        {
            var data = user.UserData!.Split(',');
            var userId = int.Parse(data[0]);
            return new UserData(userId, data[1], int.Parse(data[2]), data[3]);
        }
    }

    public class UserData
    {
        public int UserId { get; private set; }

        public string NickName { get; private set; }


        public UserData(int userId, string nickName, int deptId, string deptName)
        {
            UserId = userId;
            NickName = nickName;
        }
    }
}
